package com.csair.seam.controller.pc;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.csair.seam.domain.model.entity.EquipCategory;
import com.csair.seam.domain.model.entity.EquipCategoryNode;
import com.csair.seam.domain.service.IEquipCategoryService;
import com.csair.seam.infrastructure.web.BaseController;
import com.csair.seam.infrastructure.web.BaseResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "设备类别服务接口")
@RestController
@RequestMapping("/pc/category")
public class EquipCategoryController extends BaseController {
    @Autowired
    private IEquipCategoryService equipCategoryService;

    @GetMapping("/level/1")
    @ApiOperation(value = "设备一级类别", notes = "查询与设备有关联的一级类别", httpMethod = "GET")
    public BaseResponse<List<EquipCategory>> getLevel1Category(@RequestParam(required = false) String flag){
        return buildSuccess(equipCategoryService.findLevel1CategoryList(flag));
    }
    
    @ApiOperation(value = "设备类别树形列表",notes = "getEquipCategoryList",httpMethod = "GET")
    @GetMapping(value = "/tree")
    public BaseResponse<List<EquipCategoryNode>> getEquipCategoryList(){
        return buildSuccess(equipCategoryService.findEquipCategoryTree());
    }

}
